package com.tycmc.kafka;

import com.tycmc.common.util.Property;
import org.apache.kafka.clients.producer.KafkaProducer;

import ty.pub.TransPacket;

import java.util.Properties;

public class CreateKafkaProducer {

    public KafkaProducer<String, String> initDaily() {
        //创建日志队列kafka生产者
        Properties proProducer = new Properties();
        proProducer.put("bootstrap.servers", Property.getProperty("producerDaily.bootstrap.servers"));
        proProducer.put("key.serializer", Property.getProperty("producerDaily.key.serializer"));
        proProducer.put("value.serializer", Property.getProperty("producerDaily.value.serializer"));
        return new KafkaProducer<>(proProducer);
    }

    public KafkaProducer<String, String> initKafkaStorage() {
        //创建保存数据的kafka生产者
        Properties proProducer = new Properties();
        proProducer.put("bootstrap.servers", Property.getProperty("producerStorage.bootstrap.servers"));
        proProducer.put("key.serializer", Property.getProperty("producerStorage.key.serializer"));
        proProducer.put("value.serializer", Property.getProperty("producerStorage.value.serializer"));
        return new KafkaProducer<>(proProducer);
    }
    
}
